//
//  YSHomeGridCell.m
//
//
//  Created by Northwan on 15/7/18.
//  Copyright (c) 2015年 悦食中国. All rights reserved.
//

#import "YSHomeGridCell.h"
#import "YSHomeGridItemView.h"

@interface YSHomeGridCell()
@property (strong,nonatomic)  YSHomeGridItemView *cardItemView;
@property (strong,nonatomic)  YSCardGridItemFrame *cardGridFrame;
@property (assign,nonatomic)  HomeSubViewSourceType sourceType;

@end

@implementation YSHomeGridCell

+ (instancetype)cellWithTableView:(UITableView *)tableView
{
    static NSString *ID = @"YSHomeGridCell";
    YSHomeGridCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
    if (!cell) {
        cell.userInteractionEnabled = YES;
        cell = [[YSHomeGridCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:ID];
    }
    return cell;
}

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        YSHomeGridItemView *cardItemView =  [[YSHomeGridItemView alloc]init];
        cardItemView.userInteractionEnabled = YES;
        self.cardItemView = cardItemView;
        [self addSubview:cardItemView];
    }
    return self;
}

-(void)setCardGridFrame:(YSCardGridItemFrame *)cardGridFrame sourceType:(HomeSubViewSourceType)sourceType{
    _cardGridFrame = cardGridFrame;
    _sourceType = sourceType;
    _cardItemView.sourceType = sourceType;
    _cardItemView.cardGridFrame = cardGridFrame;
}

@end
